package com.model;

import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;


public class EventoDataModel extends ListDataModel<Evento> implements SelectableDataModel<Evento> {
	
	public EventoDataModel(){
	}
	
	public EventoDataModel(List<Evento> data){
		super(data);
	}

    @Override
    public Evento getRowData(String rowKey) {
        List<Evento> eventos = (List<Evento>) getWrappedData();
        for(Evento event : eventos) {
            if(event.getId().equals(rowKey))
                return event;
        }

        return null;
    }

    @Override
    public Object getRowKey(Evento evento) {
        return evento.getId();
    }

}
	

